package com.tz.farmer.controller;


import com.smartPark.msframe.result.ResultEx;
import com.tz.farmer.service.CorrectService;
import com.tz.farmer.so.BaseSo;
import com.tz.farmer.so.FarmerCorrectSo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description: 辟谣助手（h5）
 * @name BusinessController
 * @author: xhj
 * @date: 2021/6/23
 * @version V1.0
 */
@RestController
@RequestMapping("correct")
@Api(value = "辟谣助手（h5）", tags = "辟谣助手（h5）控制器")
public class CorrectController {

    private static Logger logger = LoggerFactory.getLogger(CorrectController.class);

    @Resource
    CorrectService correctService;


    /**
     * @description:  查询辟谣助手信息
     * @name businessInfo
     * @author: xhj
     * @date: 2021/7/13 11:35
     * @version V1.0
     */
    @ApiOperation("查询辟谣助手信息")
    @GetMapping("correctInfo")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "flag", value = "农/渔（0：农  1：渔）", defaultValue = ""),
    })
    public ResultEx getCorrectInfo(BaseSo baseSo) {
        try {
            return correctService.getCorrectInfo(baseSo);
        }catch (Exception e){
            logger.error("辟谣助手获取失败",e);
            return ResultEx.builder().makeFailedResult("辟谣助手获取失败");

        }
    }


    /**
     * @description:  查询辟谣助手详情信息
     * @name businessInfo
     * @author: xhj
     * @date: 2021/7/13 11:35
     * @version V1.0
     */
    @ApiOperation("查询辟谣助手详情信息")
    @GetMapping("correctDetailInfo")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "辟谣助手id", defaultValue = ""),
    })
    public ResultEx getCorrectDetailInfo(FarmerCorrectSo farmerCorrectSo) {
        try {
            return correctService.getCorrectDetailInfo(farmerCorrectSo);
        }catch (Exception e){
            logger.error("辟谣助手详情获取失败",e);
            return ResultEx.builder().makeFailedResult("辟谣助手详情获取失败");

        }
    }

}
